package com.example.demo;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.validation.annotation.Validated;
import com.example.demo.WelcomeService;


@RestController
public class HomeController{

  @Autowired
  private WelcomeService service;



  @RequestMapping(value="/{id}",method=RequestMethod.GET)
  public String home(@PathVariable long id) {



    return service.hello(id) ;
  }

  @RequestMapping(value="/{id}",method=RequestMethod.PUT)
  public String update(@PathVariable long id,@Validated @RequestBody User user){
    return service.update(id,user);
  }

}
